package com.project.service.impl;

import com.project.bean.ProductBean;
import com.project.mapper.IProductMapper;
import com.project.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ProductServiceImpl implements IProductService {
    @Autowired
    private IProductMapper productMapper;

    @Override
    public void add(ProductBean product) {
        productMapper.insert(product);
    }

    @Override
    public void update(int id, int price) {
        ProductBean productBean = productMapper.selectById(id);
        productBean.setPrice(price);
        productMapper.updateById(productBean);
    }
}
